Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Melihat subscription package #71

Merged
merged 5 commits into from
May 7, 2024

Conversation

nataniadeandra
Copy link
Contributor

This pull request introduces several updates to improve the user experience and provide more information to our users.

Changes Made:

  1. Added Package to Navbar: The package option has been added to the navigation bar for easier access and improved visibility.
  2. Display Package Description: Updated the package description display to include detailed information about both free and premium packages. This allows users to make an informed decision when choosing between free and premium packages.
  3. Display Subscription End Date for Premium Users: For premium users, the subscription end date is now displayed. This provides premium users with a clear understanding of their subscription status and renewal date.
  4. Test Cases: Created both positive and negative test cases for this feature to ensure its robustness and reliability.

Comment on lines 30 to 33
providesTags: (result) => [
{ type: 'LatestSubscription', id: result?.id },
'LatestSubscription',
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the documentation, it's always a great idea to check first whether result variable exist or not. You can refer it here:

https://redux-toolkit.js.org/rtk-query/usage/automated-refetching#providing-cache-data

Comment on lines 20 to 23
const { data: free_package = {} as PackageDetailResponse } =
useGetPackageDetailQuery(1)
const { data: premium_package = {} as PackageDetailResponse } =
useGetPackageDetailQuery(2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, you can use variable for the number. I get what you are saying because 1 means package with id: 1. But what if the schema changes and id become UUID format, this will be hard to maintain, so you can refactor this to a constant.ts so that you don't have to change the main package list code.

constant.ts

export const PACKAGE = {
     "free": 1,
     "premium": 2
}

Then you can call these constant, such as PACKAGE["free"]

Feels free to have an opinion about my comments though!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have fixed! Please check 😃 @emiriko @JohannesSetiawan

Copy link
Contributor

@JohannesSetiawan JohannesSetiawan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good implementation, but please address the problem that alvaro mentioned.

Copy link
Member

@emiriko emiriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@carlenee carlenee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nataniadeandra nataniadeandra merged commit ffcdd22 into staging May 7, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants